package prototypePatter1;

import lombok.extern.slf4j.Slf4j;

/**
 * @Author: 582895699@qq.com
 * @Desctription: 原型模式
 * @Date: Created in 2021/12/16 17:17
 */
@Slf4j
public class Test implements Cloneable {

    private String name;

    public Test() {
        log.info("执行构造函数");
    }

    public Test(String name) {
        this.name = name;
    }

    @Override
    protected Test clone() throws CloneNotSupportedException {
        return (Test) super.clone();
    }

    public static void main(String[] args) throws CloneNotSupportedException {
        // 第一次初始化
        Test test = new Test();
        Test clone = test.clone();
    }
}
